package myJs.cps.myTable

import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.all._
import myJs.cps._
import myJs.myPkg.i18n.ReactI18next

import scala.collection.immutable.SeqMap
import scala.scalajs.js
import cats.effect._
import japgolly.scalajs.react.util.EffectCatsEffect._

/** Created by yz on 15/9/2023
  */
object NumericSearchLiCp {

  case class Props(min: String, minChange: String => IO[Unit], max: String, maxChange: String => IO[Unit])

  val Component = ScalaFnComponent[Props] { props =>
    li(
      className := "myLi myInputLi dateInput",
      div(
        marginBottom := 10.px,
        span(className := "fa fa-filter"),
        s" Range"
      ),
      div(
        marginBottom := 10.px,
        className := "form-group",
        div(
          className := "col-sm-12",
          PureInputCp.Props(
            name = "min",
            value = props.min,
            placeHolder = "Min",
            onChange = props.minChange
          ).render
        )
      ),
      div(
        className := "form-group",
        div(
          className := "col-sm-12",
          PureInputCp.Props(
            name = "max",
            value = props.max,
            placeHolder = "Max",
            onChange = props.maxChange
          ).render
        )
      )
    )

  }

  def apply(
      min: String,
      minChange: String => IO[Unit],
      max: String,
      maxChange: String => IO[Unit]
  ) = {
    Component(
      Props(
        min,
        minChange,
        max,
        maxChange
      )
    )
  }

}
